/* 
 * File:   maplayer.h
 * Author: bjorn
 *
 * Created on September 2, 2007, 9:15 PM
 */

#ifndef _MAPLAYER_H
#define	_MAPLAYER_H

#include "object.h"
#include "screen.h"
#include "image.h"

#ifdef	__cplusplus
extern "C" {
#endif

eruta_object(Maplayer);
eruta_object(Terraintile);
eruta_object(Terrainlayer);

#define TILE_NORMAL   (0)
/* A normal tile. */
#define TILE_BLOCK    (1)
/* A blocking tile */
#define TILE_SLIPPERY (2)
/* A slippery tile */
#define TILE_WATER    (4)
/* A tile under water */
#define TILE_PAIN     (8)
/* A tile that causes damage. */
#define TILE_PUSH_N   (16)
#define TILE_PUSH_E   (32)
#define TILE_PUSH_S   (64)
#define TILE_PUSH_W   (128)

typedef unsigned char Terrainkind;
typedef signed char   Terrainhigh;

#define TERRAIN_MOST_DEEP -120 
#define TERRAIN_MOST_HIGH  120 
#define TERRAIN_GROUND_HIGH  0 

#define MAPLAYER_TILE_HIGH 32
#define MAPLAYER_TILE_WIDE 32

extern Maplayer maplayer_make(long wide, long high); 

extern Maplayer maplayer_wipe(Maplayer self); 

extern int maplayer_add(Maplayer self, SDL_Surface * tile); 

extern Maplayer maplayer_set(Maplayer self, int x, int y, int tile_id); 

extern Image maplayer_get(Maplayer self, int x, int y); 

extern Maplayer maplayer_draw(Maplayer self, Screen target, int x, int y ); 


#ifdef	__cplusplus
}
#endif

#endif	/* _MAPLAYER_H */

